package com.kgc.service.Impl;

import com.kgc.dao.mapper.ArticlesMapper;
import com.kgc.dao.mapper.PointsMapper;
import com.kgc.entity.PointsLog;
import com.kgc.entity.PointsRules;
import com.kgc.service.interf.PointsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("pointsService")
public class PointsServiceImpl implements PointsService {
//   积分模块
    @Autowired
    private PointsMapper pointsMapper;

    //查询积分  用于发布文章给用户增加积分
    @Override
    public List<PointsRules> getPoints(PointsRules p) {
        return pointsMapper.getPoints(p);
    }

    //给用户添加积分
    @Override
    public int addPoints( int points,int userID) {
        return pointsMapper.addPoints(userID,points);
    }

    //积分流水
    @Override
    public int addPointsFlow(PointsLog p) {
        return pointsMapper.addPointsFlow(p);
    }

    //查看积分流水
    @Override
    public List<PointsLog> getPointsFlow(int userID) {
        return pointsMapper.getPointsFlow(userID);
    }


    //   管理员功能模块
//--------------------------------------------------------------------------------

    //    查看积分规则
    @Override
    public List<PointsRules> getPointsRules() {
        return pointsMapper.getPointsRules();
    }

    //修改积分规则
    @Override
    public int updatePointsRules(int ruleID,int pointsValue) {
        return pointsMapper.updatePointsRules(ruleID,pointsValue);
    }

    //管理员手动给用户增加积分
    @Override
    public int manuallyaddIntegralrule(int userID,int pointsValue) {
        return pointsMapper.manuallyaddIntegralrule(userID,pointsValue);
    }


}
